package com.tubi.LocalDateTime;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LocalDateTime5 {
    public static void main(String[] args) {
//        String now =LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyy-MM-dd HH:mm:ss"));

        LocalDateTime now = LocalDateTime.now();
        //| 方法名                                         | 说明           |
        //| public LocalDateTime plusYears (long years)    | 添加或者减去年 |
        LocalDateTime plusYears = now.plusYears(1);
        System.out.println(plusYears);
        //| public LocalDateTime plusMonths(long months)   | 添加或者减去月 |
        LocalDateTime plusMonths = now.plusMonths(1);
        System.out.println(plusMonths);
        //| public LocalDateTime plusDays(long days)       | 添加或者减去日 |
        LocalDateTime plusDays = now.plusDays(2);
        System.out.println(plusDays);
        //| public LocalDateTime plusHours(long hours)     | 添加或者减去时 |
        LocalDateTime plusHours = now.plusHours(2);
        System.out.println(plusHours);
        //| public LocalDateTime plusMinutes(long minutes) | 添加或者减去分 |
        //| public LocalDateTime plusSeconds(long seconds) | 添加或者减去秒 |
        //| public LocalDateTime plusWeeks(long weeks)     | 添加或者减去周 |


        ////////////////////////////// minus与pluse 相反
        //| 方法名                                          | 说明           |
        //| public LocalDateTime  minusYears (long years)   | 减去或者添加年 |
        LocalDateTime minusYears = now.minusYears(2);
        System.out.println(minusYears);
        //| public LocalDateTime  minusMonths(long months)  | 减去或者添加月 |
        //| public LocalDateTime minusDays(long days)       | 减去或者添加日 |
        //| public LocalDateTime minusHours(long hours)     | 减去或者添加时 |
        //| public LocalDateTime minusMinutes(long minutes) | 减去或者添加分 |
        //| public LocalDateTime minusSeconds(long seconds) | 减去或者添加秒 |
        //| public LocalDateTime minusWeeks(long weeks)     | 减去或者添加周 |
    }
}
